package net.zoneland.knowledge.enums;

import com.branchitech.utils.enums.EnumExtend;
import com.branchitech.utils.enums.EnumUtils;

/**
 * 会议类型enum.
 * @author zx
 */
public enum RecordTypeEnum implements EnumExtend {
    BRANCH_COMMITTEE(1, "支部委员会","BRANCH_COMMITTEE"),
    PARTY_GROUP(2,"党小组会","PARTY_GROUP"),
    BRANCH_COMMITTEE_LARGE(3,"支部党员大会","BRANCH_COMMITTEE_LARGE"),
    PARTY_CLASS(4,"党课","PARTY_CLASS"),
    PARTY_DAY(5,"主题党日","PARTY_DAY")
    ;

    /**
     * 整数key.
     */
    private final transient int intKey;

    /**
     * 字符串key.
     */
    private final transient String stringKey;

    /**
     * 显示标签.
     */
    private final transient String label;

    /**
     * @param intKey    整数key
     * @param stringKey 字符串key
     * @param label     标签
     */
    RecordTypeEnum(final int intKey, final String stringKey, final String label) {
        this.intKey = intKey;
        this.stringKey = stringKey;
        this.label = label;
    }

    public static String getByIntKey(final String index) {
        return getByIntKey(Integer.valueOf(index)).getStringKey();
    }

    /**
     * 通过枚举字符串关键字获取枚举.
     *
     * @param key 枚举字符串关键字
     * @return 枚举字符串关键字对应的枚举常量实例
     */
    public static RecordTypeEnum getByStringKey(final String key) {
        return EnumUtils.getByStringKey(RecordTypeEnum.class, key);
    }

    /**
     * 通过枚举关键字获取枚举.
     *
     * @param index 枚举关键字
     * @return 枚举字符串关键字对应的枚举常量实例
     */
    public static RecordTypeEnum getByIntKey(final int index) {
        return EnumUtils.getByIntKey(RecordTypeEnum.class, index);
    }

    @Override
    public int getIntKey() {
        return intKey;
    }

    @Override
    public String getStringKey() {
        return stringKey;
    }

    @Override
    public String getLabel() {
        return label;
    }
}
